package com.filldream.fastboot.common.util.entity.wx;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.apache.commons.lang3.ObjectUtils;

@ApiModel(value = "微信登陆-微信授权-APP")
@Data
public class WxInitSTO extends LoginCodeSTO {

    @ApiModelProperty(value = "仅小程序传入(弹框授权时传入)")
    private String encryptedData;

    @ApiModelProperty(value = "仅小程序传入(弹框授权时传入)")
    private String iv;

    @ApiModelProperty(value = "appSecret,后端传入，前端不用管",hidden = true)
    private String appSecret;


    @ApiModelProperty(value = "用户昵称(小程序静默登录时传入,静默时必传)")
    private String nickName;

    @ApiModelProperty(value = "性别0-位置 1-男 2-女(小程序静默登录时传入,静默时必传)")
    private Integer gender;

    @ApiModelProperty(value = "微信小程序用户头像(小程序静默登录时传入,静默时必传)")
    private String avatarUrl;

    @ApiModelProperty(value = "国家(静默登录时可选择传入)")
    private String country;

    @ApiModelProperty(value = "省(静默登录时可选择传入)")
    private String province;

    @ApiModelProperty(value = "城市(静默登录时可选择传入)")
    private String city;

    @ApiModelProperty(value = "语言(静默登录时可选择传入)")
    private String language;

    /**
     * @author RickSun
     * @Description 校验静默登录的参数是否为空
     * @date 2022/1/7 18:26
     * @return boolean true-静默登录 false-授权登录
     **/
    public boolean checkSilent(){
        return  ObjectUtils.isEmpty(nickName) || ObjectUtils.isEmpty(gender) || ObjectUtils.isEmpty(avatarUrl);
    }



}
